# Maintainer: Jonas Witschel <diabonas@archlinux.org>
pkgname=java-commons-lang
pkgver=3.12.0
pkgrel=1
pkgdesc='A host of helper utilities for the java.lang API'
arch=('any')
url='https://commons.apache.org/proper/commons-lang/'
license=('APACHE')
depends=('java-runtime-headless')
makedepends=('maven')
source=("https://www.apache.org/dist/commons/lang/source/commons-lang3-$pkgver-src.tar.gz"{,.asc}
        'java-commons-lang-3.10_improve-reproducibility-of-generated-JARs.patch')
sha512sums=('80d1b960ae0b02859be329ea60d68cef33f3c7be7ec19752b3c9cfef442adef480878317ce2cfa309a27e662e2c72cab22023eaa3702e27970a1e5d55ca43f57'
            'SKIP'
            'e07e11717ac80e2232a1e4161bd9bc76e7e0d5d6e8a616077fd03f06c3501010e7b5f8e67d24a69acca06df020e4a59bb2cf005163ae3ee0ab9f149cc8f1c796')
validpgpkeys=('B6E73D84EA4FCC47166087253FAAD2CD5ECBB314'  # Rob Tompkins <chtompki@apache.org>
              '2DB4F1EF0FA761ECC4EA935C86FDC7E2A11262CB') # Gary David Gregory (Code signing key) <ggregory@apache.org>

prepare() {
	cd "commons-lang3-$pkgver-src"
	# Remove build-dependent manifest headers from JAR (https://github.com/apache/commons-lang/pull/578)
	patch --strip=1 --input="$srcdir/java-commons-lang-3.10_improve-reproducibility-of-generated-JARs.patch"
}

build() {
	cd "commons-lang3-$pkgver-src"
	mvn -Dproject.build.outputTimestamp="$SOURCE_DATE_EPOCH" -Dmaven.javadoc.skip=true -Dmaven.test.skip=true clean package
}

check() {
	cd "commons-lang3-$pkgver-src"
	mvn test
}

package() {
	cd "commons-lang3-$pkgver-src"
	install -Dm644 "target/commons-lang3-$pkgver.jar" -t "$pkgdir/usr/share/java/commons-lang"
	ln -s "commons-lang3-$pkgver.jar" "$pkgdir/usr/share/java/commons-lang/commons-lang.jar"
}
